<template>
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center cs_flex_0_ibhf"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub cs_fd0_0_ibhf'>
					<view class='flex flex-wrap align-center cs_fd0_0_c0_ibhf' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  cs_fd0_0_c0_c0_ibhf'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='cs_fd0_0_c1_c0_ibhf'>{{testName}}</text>
					</view>
					<view class='flex flex-wrap align-center justify-end cs_fd0_0_c0_ibhf'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="time" v-if="answer_time">
				<image style="width: 40rpx;height: 40rpx;margin-right: 20rpx; " src="/static/exam/time.png" mode="">
				</image>{{timeDisplay }}
			</view>
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout">
				<view class='flex flex-direction align-stretch cs_fd1_0_ibhf'>
					<view class='flex flex-wrap align-center cs_fd1_0_c0_ibhf'>

						<view class='flex  cs_fd1_0_c0_c0_ibhf'></view>

						<text class='cs_fd1_0_c0_c1_ibhf'>{{item.typename}}题</text>
						<text class='cs_fd1_0_c0_c3_ibhf'>{{currentIndex + 1}}</text>
						<text class='cs_fd1_0_c0_c4_ibhf'>/</text>
						<text class='cs_fd1_0_c0_c4_ibhf'>{{list.length}}</text>
					</view>
					<view class='flex flex-wrap align-center cs_fd1_0_c1_ibhf'>
						<text class='cs_fd1_0_c0_c1_ibhf'>{{item.title}}</text>
					</view>
					<view class='flex flex-direction align-stretch' v-if="item.type==1 || item.type==2 || item.type==3"> <!-- isanswer 这道题是否回答   items.ischeck 这个选项是否选择了 item.result选的是否正确  1 正确 0 错误-->
						<view  @tap.stop="check(item.type,items,index)" v-if="item.type!=2" class='flex flex-wrap align-center cs_fd1_0_c2_c1_ibhf ' :class="!item.isanswer?'':items.ischeck?item.result==1?'cs_fd1_0_c2_c0_ibhf':'cs_fd1_0_c2_c2_ibhf':''" v-for="(items,index) in item.options" :key='index'>
							<view class='flex flex-wrap align-center justify-center cs_fd1_0_c2_c0_c0_ibhf'>
								<text class='cs_fd1_0_c2_c0_c0_c0_ibhf'>{{items.label}}</text>
							</view>
							<view class='flex flex-wrap align-center'>
								<text>{{items.value}}</text>
							</view>
						</view>
						<!--  :class="items.ischeck?'cs_fd1_0_c2_c0_ibhf':!item.isanswer?'':items.ischeck?item.result==1?'cs_fd1_0_c2_c0_ibhf':'cs_fd1_0_c2_c2_ibhf':''"  -->
							<!--	多选 没确认				-->																			<!-- istj 此多选题是否回答 iszq 此项是否正确答案-->
						<view  @tap.stop="check(item.type,items,index)" v-if="item.type==2 && !item.istj" class='flex flex-wrap align-center cs_fd1_0_c2_c1_ibhf ' :class="item.istj?items.ischeck?items.iszq?'cs_fd1_0_c2_c0_ibhf':'cs_fd1_0_c2_c2_ibhf':'cs_fd1_0_c2_c2_ibhf':items.ischeck?'cs_fd1_0_c2_c0_ibhf':''" v-for="(items,index) in item.options" :key='index'>
							<view class='flex flex-wrap align-center justify-center cs_fd1_0_c2_c0_c0_ibhf'> 
								<text class='cs_fd1_0_c2_c0_c0_c0_ibhf'>{{items.label}}</text>
							</view>
							<view class='flex flex-wrap align-center'>
								<text>{{items.value}}</text>
							</view>
						</view>
						<!--	多选 确认-->			
						<view   v-if="item.type==2 && item.istj" class='flex flex-wrap align-center cs_fd1_0_c2_c1_ibhf ' :class="item.istj?(items.iszq && items.ischeck)?'cs_fd1_0_c2_c0_ibhf':(!items.iszq && items.ischeck)?'cs_fd1_0_c2_c2_ibhf':'':''" v-for="(items,index) in item.options" :key='index'>
							<view class='flex flex-wrap align-center justify-center cs_fd1_0_c2_c0_c0_ibhf'> 
								<text class='cs_fd1_0_c2_c0_c0_c0_ibhf'>{{items.label}}</text>
							</view>
							<view class='flex flex-wrap align-center'>
								<text>{{items.value}}</text>
							</view>
						</view>
						
						<view class='flex flex-wrap align-center justify-center' style="margin-top:32rpx ;" v-if="item.type==2">
							<button class='cs_fd1_0_c5_c0_ibhf' v-if="!item.istj" @tap.stop="tjdxFunc(2,0)">确认</button>
						</view>
					</view>
					<view class='flex flex-wrap cs_fd1_0_c4_ibhf' v-if="item.type==4 || item.type==5">
						<benben-textarea class='flex cs_input_fd1_0_c4_ibhf' :placeholder="'请输入'"
							:adjust-position='true' :maxlength="240" :show-num='true'
							placeholder-style="color:#999;font-size:28rpx" v-model="answer" />
						<template>
							<view class='flex flex justify-end cs_numberfd1_0_c4_c0_ibhf'>
								<text>{{answer.length}}</text>
								<text>/</text>
								<text>240</text>
							</view>
						</template>
						
					</view>
					<view class='flex flex-wrap align-center justify-center' style="margin-top:32rpx ;" v-if="item.type==4 || item.type==5">
						<button class='cs_fd1_0_c5_c0_ibhf' v-if="(item.answer || answer) && !item.isanswer" @tap.stop="tjFunc()">确认</button>
					</view>
					<view class='flex flex-direction flex-wrap align-stretch' v-if="item.type==6">
						<view class='flex flex-direction align-stretch cs_fd1_0_c3_c0_ibhf'>
						<!-- 	<view class='flex align-center cs_fd1_0_c3_c0_c0_ibhf'>
								<image class='cs_fd1_0_c3_c0_c0_c0_ibhf' mode="aspectFit" :src='STATIC_URL+"stcimg/01.png"'></image>
								<text>附件名称.mp4</text>
								<image class='cs_fd1_0_c3_c0_c0_c2_ibhf' mode="aspectFit" :src='STATIC_URL+"stcimg/6.png"'></image>
							</view> -->
							<!-- <view class='flex flex-wrap align-center justify-center cs_fd1_0_c3_c0_c2_ibhf' @tap.stop="upwj()">
								<text class='fu-iconfont2'>&#xe7b0;</text>
								<text>上传附件</text>
							</view> -->
							<benben-files-upload :file-list.sync="fileLists" class="flex flex-direction align-stretch flex cs_fd1_0_c3_c0_c1_ibhf" ref="benbenFilesUploadfd1_0_c3_c0_c1" :is-show-clean='true' :maxlength="10">
							    <template v-slot="{ fileList }">
							        <view class="flex-direction align-stretch cs_flex_list_fd1_0_c3_c0_c1_ibhf">
										<view class='flex align-center cs_fd1_0_c3_c0_c0_ibhf' v-for="(flie, index) in fileList" :key="index">
											<image class='cs_fd1_0_c3_c0_c0_c0_ibhf' mode="aspectFit" :src='STATIC_URL+"stcimg/01.png"'></image>
											<text @tap.stop="$refs.benbenFilesUploadfd1_0_c3_c0_c1.previewFile(index)">{{ flie.name }}</text>
											<image class='cs_fd1_0_c3_c0_c0_c2_ibhf' mode="aspectFit" @tap.stop="$refs.benbenFilesUploadfd1_0_c3_c0_c1.delFile(index)" :src='STATIC_URL+"stcimg/6.png"'></image>
										</view>
							       <!--     <view v-for="(flie, index) in fileList" :key="index" class="flex  cs_flex_file_fd1_0_c3_c0_c1_ibhf">
							                <text class=" cs_flex_text_fd1_0_c3_c0_c1_ibhf" @tap.stop="$refs.benbenFilesUploadfd1_0_c3_c0_c1.previewFile(index)">{{ flie.name }}</text>
							                <text class="fu-iconfont2  cs_flex_icon_fd1_0_c3_c0_c1_ibhf" @tap.stop="$refs.benbenFilesUploadfd1_0_c3_c0_c1.delFile(index)">&#xE8E7;</text>
							            </view> -->
							        </view>
							        <button class='cs_fd1_0_c3_c0_c11_ibhf' @tap.stop="$refs.benbenFilesUploadfd1_0_c3_c0_c1.manyChooseFiles()">上传文件</button>
							    </template>
							</benben-files-upload>
							<view class='flex flex-wrap align-center'>
								<text class='cs_fd1_0_c3_c0_c1_c0_ibhf'>*</text>
								<text class='cs_fd1_0_c3_c0_c1_c1_ibhf'>附件上传仅支持文档、视频、音频、图片</text>
							</view>
						</view>
					</view>
				</view>
			</view>

			<!---flex布局flex布局结束-->
			<!---flex布局2flex布局开始-->
		<!-- 	<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout cs_flex_2_ibhf" v-if='item.isanswer && item.type!=6'>
				<view class='flex flex-wrap align-center justify-center cs_fd2_0_ibhf'>
					<image class='cs_fd2_0_c0_ibhf' mode="aspectFit" :src='STATIC_URL+"stcimg/2.png"'></image>
					<text class='cs_fd2_0_c1_ibhf'>答案解析</text>
					<image class='cs_fd2_0_c0_ibhf' mode="aspectFit" :src='STATIC_URL+"stcimg/2.png"'></image>
				</view>
				<view class='flex flex-direction align-stretch cs_fd2_0_ibhf' v-if="item.type!=4">
					<view class='flex align-stretch cs_fd2_0_ibhf'>
						<image class='cs_fd2_1_c0_c0_ibhf' mode="aspectFit" :src='item.result==1?STATIC_URL+"stcimg/3.png":STATIC_URL+"stcimg/4.png"'></image>
						<text class='cs_fd2_1_c0_c1_ibhf'>{{item.result==1?"回答正确":'回答错误'}}</text>
					</view>
					
					<view class='flex flex-wrap align-center cs_fd2_1_c2_ibhf'>
						<text>正确答案：</text>
						<text class='cs_fd2_1_c2_c1_ibhf'>{{item.type==5?item.value:(item.type==1||item.type==2||item.type==3)?item.daan:''}}</text>
						<text class='cs_fd2_1_c2_c2_ibhf'>您的答案：</text>
						<text class='cs_fd2_1_c2_c1_ibhf' v-if="item.type==1 ||  item.type==3">{{item.options[item.answer].label}}</text>
						<text class='cs_fd2_1_c2_c1_ibhf' v-if="item.type==2">{{item.wdda}}</text>
						<text class='cs_fd2_1_c2_c1_ibhf' v-if="item.type==4||  item.type==5">{{item.answer}}</text>
					</view>
				</view>
				<view class='flex flex-direction flex-wrap align-stretch cs_fd2_0_ibhf'>
					<view class='flex flex-wrap align-center cs_fd2_2_c0_ibhf'>
						<text class='cs_fd2_2_c0_c0_ibhf'>知识点：</text>
					</view>
					<view class='flex flex-wrap align-center cs_fd2_2_c1_ibhf'>
						<text>{{item.zhishidian}}</text>
					</view>
				</view>
				<view class='flex flex-direction flex-wrap align-stretch'>
					<view class='flex flex-wrap align-center cs_fd2_2_c0_ibhf'>
						<text class='cs_fd2_2_c0_c0_ibhf'>答案解析：</text>
					</view>
					<view class='flex flex-wrap align-center cs_fd2_2_c1_ibhf'>
						<jyf-parser class='cs_fd2_3_c2_ibhf' :html="item.analysis | richTextFormat">
							
						</jyf-parser>
					</view>
				</view>
			</view> -->

			<!---flex布局2flex布局结束-->
			<!---flex布局3flex布局开始-->
			<view class="flex benben-flex-layout flex-wrap align-center cs_flex_3_ibhf">
			</view>

			<!---flex布局3flex布局结束-->
			<view class="flex flex-wrap align-center justify-around benben-position-layout flex cs_flex_4_ibhf" >
				<view class='flex flex-wrap align-center justify-center cs_fd4_0_ibhfs' v-if="currentIndex ==0">
					<text class='cs_fd4_0_c0_ibhf' ></text>
				</view>
				<view class='flex flex-wrap align-center justify-center cs_fd4_0_ibhf' v-if="currentIndex !=0"  @tap.stop="step()">
					<text class='cs_fd4_0_c0_ibhf' >上一题</text>
				</view>
				<view class='flex flex-wrap align-center justify-center cs_fd4_1_ibhf' v-if="currentIndex != finallynum "  @tap.stop="next()" >
					<text class='cs_fd4_1_c0_ibhf' >下一题</text>
				</view>
				<view class='flex flex-wrap align-center justify-center cs_fd4_1_ibhf' v-if="currentIndex == finallynum "  @tap.stop="tjda(1)" >
					<text class='cs_fd4_1_c0_ibhf' >提交</text>
				</view>
				

			</view>
			<view :style="{height: '190rpx'}"></view>


		</view>
	</page-body>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				id: '',//考试id
				list: [],//题目数组
				item: {},//当前显示题的数据
				"currentIndex": 0,//当前显示题目的下表
				answer: '',//答案 
				finallynum:0,//题目数量
				answer_time:'',//时间 分钟
				fileLists:[],//上穿的文件
				remainingSeconds:0,//限制时长
				timer: null,//倒计时
				istj:false,//防止连点
				time:'',//开始时间
				time1:'',//结束时间
				testName:'',//考试名称
			};
		},
		computed: {
			timeDisplay() {
				const h = String(Math.floor(this.remainingSeconds / 3600)).padStart(2, '0');
				const m = String(Math.floor((this.remainingSeconds % 3600) / 60)).padStart(2, '0');
				const s = String(this.remainingSeconds % 60).padStart(2, '0');
				return `${h}:${m}:${s}`;
			}
		},
		watch: {},
		onLoad(options) {
			// 题目类型（1单选2多选3判断4简答5填空6开放）
			// 单选  多选 判断  value返回的答案都是 选项的下标
			// 填空 value 是返回的答案
			// 简答题 不判断对错 只显示解析
			//开放题 不判断对错  不显示解析
			this.id = options.exampaper_id
			this.testName=options.testName
			this.time = options.time * 60
			this.time1 = options.time1
			this.messid=options.messid
			this.answer_time=options.time
			this.getmj86732c66618cFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//查询学习课程信息
			async getmj86732c66618cFunc() {
				//请求方法
				//数据验证

				let datakclist = await this.$api.post(global.apiUrls.post684b92c80c9e7, {
					exampaper_id: this.id
				});

				if (datakclist.data.code != 1) {
					this.$message.info(datakclist.data.msg);
					return
				}
				let infokclist = datakclist.data;
				// this.answer_time=infokclist.data.answer_time
				this.list = infokclist.data.list;
				this.remainingSeconds=infokclist.data.answer_time 
				// this.remainingSeconds=1 * 60
				if(this.answer_time){
					this.startCountdown();
				}
				
				if (this.list.length == 0) {
					this.$message.info('暂无题目');
					setTimeout(() => {
						uni.navigateBack();
					}, 800);
					return;
				}
				this.list.map(item => {
					// 题目类型（1单选2多选3判断4简答5填空6开放）
					item.type=item.type=='radio'?1:item.type=='selected'?2:item.type=='torf'?3:item.type=='cloze'?5:item.question_type=='open'?6:4
					item.typename = item.type == 1 ? '单选' : item.type == 2 ? '多选' : item.type == 3 ? '判断' :
						item.type == 4 ? '简答' : item.type == 5 ? '填空' : item.type == 6 ? '开放' : ''
					item.isanswer=false//是否答题
					item.answer=''//提交的答案
					item.result=0//是否正确
					// 单选 判断的答案
					if(item.type==1 || item.type==3){
						item.daan=item.options[item.value].label
					}
					
					if(item.type==1 || item.type==2 || item.type==3){
						// 单选 多选 判断  里面的 选项是否选中
						item.options.map(itemd=>{
							itemd.ischeck=false//是否选择此项作为答案
						})
					}
					if(item.type==2){
						let str = item.value.trim()
						let arr = []
						str = str
							.replace(/，/g, ',')
							.replace(/[“”]/g, '"')
							.replace(/'/g, '"')
							try {
								// 多尝试几层解析
								let parsed = str
								while (typeof parsed === 'string' && parsed.includes('[')) {
									parsed = JSON.parse(parsed)
								}
							
								if (Array.isArray(parsed)) {
									arr = parsed.map(i => Number(i))
								} else if (!isNaN(parsed)) {
									arr = [Number(parsed)]
								}
							} catch (e) {
							
								if (str.includes(',')) {
									arr = str.split(',').map(i => Number(i.trim()))
								} else if (!isNaN(str)) {
									arr = [Number(str)]
								}
							}
						// console.log(arr)
						item.da=arr//答案选项下标 [0,1,2]
						item.daan=''//答案选项内容 A,B,C
						item.wdda=''//我选的答案
						let daan='';
						item.options.map((itemd,index)=>{
							itemd.istj=false//是否确认答案
							itemd.ischeck=false//是否选择此项作为答案
							
							if(arr.indexOf(index) !== -1){
								daan+=itemd.label +','
								itemd.iszq=true//是否正确答案
							}else{
								itemd.iszq=false//是否正确答案
							}
						})
						item.daan=daan.substring(0, daan.length - 1);
					}
					if(item.type==6){
						item.fileLists=[]//开放题上传的文件
					}
				})
				this.finallynum=this.list.length - 1
				this.item = this.list[this.currentIndex];
				// console.log(this.item)
				this.list.splice(this.currentIndex,1,this.list[this.currentIndex])
				// console.log("list的长度=>", this.list)
				
			},
			// 倒计时
			startCountdown() {
				this.remainingSeconds = this.answer_time * 60;
			
				if (this.timer) clearInterval(this.timer);
			
				this.timer = setInterval(() => {
					if (this.remainingSeconds > 0) {
						this.remainingSeconds--;
					} else {
						clearInterval(this .timer);
						//考试时间到，强制交卷
						// this.tjda(2)
					}
				}, 1000);
			},
			// 下一道
			next(){
				// console.log("list的长度=>", this.list)
				// 开放题
				if(this.item.type==6){
					this.fileLists=this.fileLists.length==0?this.item.fileLists:this.fileLists
					this.item.fileLists=this.fileLists
					// console.log(this.fileLists)
					
					// this.item.fileLists=this.fileLists
					// this.list[this.currentIndex].fileLists=this.fileLists
					if(this.item.fileLists.length==0){
						this.$message.info('请先答题')
						return
					}
					this.item.isanswer=true
					this.list[this.currentIndex].isanswer=true
					this.fileLists=[]
					
				}else{
					if(!this.list[this.currentIndex].isanswer ){
						this.$message.info('请先答题')
						return
					}
				}
				
				this.currentIndex++
				this.item=this.list[this.currentIndex]
				
				console.log(this.item)
				this.list.splice(this.currentIndex,1,this.list[this.currentIndex])
				console.log(this.list)
				// 渲染下一道 填过答案的
				if(this.item.answer){
					if(this.item.type==4 || this.item.type==5){
						this.answer=this.list[this.currentIndex].answer
					}
					
				}else{
					this.answer=''
					
				}
				if(this.item.type==6){
					this.fileLists=this.list[this.currentIndex].fileLists
				}
				
			},
			// 上一道
			step(){
				this.currentIndex--
				this.item=this.list[this.currentIndex]
				this.fileLists=this.list[this.currentIndex].fileLists
				this.list.splice(this.currentIndex,1,this.list[this.currentIndex])
				console.log(this.item)
				// 渲染上一道 填过答案的
				if(this.item.answer){
					if(this.item.type==4 || this.item.type==5){
						this.answer=this.list[this.currentIndex].answer
					}
					if(this.type==6){
						this.answer=this.list[this.currentIndex].answer
						this.fileLists=this.list[this.currentIndex].fileLists
					}
				}else{
					this.answer=''
				}
			},
			// 单多选 选择
			check(type,item,index){
				// 单选   判断
				if(type==1 || type==3){
					console.log(this.item.isanswer)
					if(this.item.isanswer){
						return
					}
					this.list[this.currentIndex].options.map(items=>{
						items.ischeck=false
					})
					this.list[this.currentIndex].options[index].ischeck=true
					this.item.options.map(items=>{
						items.ischeck=false
					})
					this.item.options[index].ischeck=true
					this.answer=item.label
					this.$forceUpdate()
					this.tjdxFunc(1,index)
				}else{
					console.log(this.item)
					// 多选
					this.item.options.map((items,indexs)=>{
						console.log(items)
						if(items.ischeck && indexs == index){
							items.ischeck=false
						}else if(!items.ischeck && indexs == index){
							items.ischeck=true
						}
						
					})
					this.list.splice(this.currentIndex,1,this.list[this.currentIndex])
					console.log(this.item)
				}
			},
			// 确认答案 单多选 判断题
			tjdxFunc(type,index){
				console.log(type)
				// 单选  判断
				if(type==1){
					this.list[this.currentIndex].answer=index.toString();
					this.item.answer=index.toString();
					this.list[this.currentIndex].isanswer=true
					this.item.isanswer=true
					// 如果回答正确
					if(index == this.item.value){
						this.list[this.currentIndex].result=1
						this.item.result=1
						
					}else{
						this.list[this.currentIndex].result=0
						this.item.result=0
					}
					this.$forceUpdate()
					return
				}
				// 多选
				if(type==2){
					// 是否提交过
					console.log(this.item.istj)
					if(this.item.istj){
						return
					}
					console.log(this.item.options)
					let arr2=[]
					let wdda=''
					let answer=''
					this.item.options.map((itemd,indexd)=>{
						if(itemd.ischeck){
							wdda +=itemd.label+','
							answer+=indexd+','
							arr2.push(indexd)
						}
					})
					
					wdda=wdda.substring(0, wdda.length - 1);
					answer=answer.substring(0, answer.length - 1);
					this.item.istj=true
					this.item.wdda=wdda
					let iszq=JSON.stringify(this.item.da) === JSON.stringify(arr2);
					if(iszq){
						this.item.ischeck=false
					}else if(!iszq){
						this.item.ischeck=true
					}
					answer=answer.split(',').map(item=>parseInt(item))
					this.list[this.currentIndex].answer=answer
					this.item.answer=answer
					this.list[this.currentIndex].isanswer=true
					this.item.isanswer=true
					this.$forceUpdate()
				}
				
				  
			},
			// 确认答案 简答题
			tjFunc(){
				this.list[this.currentIndex].answer=this.answer
				this.item.answer=this.answer
				this.list[this.currentIndex].isanswer=true
				this.item.isanswer=true
				// 如果回答正确
				if(this.answer == this.item.value){
					this.list[this.currentIndex].result=1
					this.item.result=1
					
				}else{
					this.list[this.currentIndex].result=0
					this.item.result=0
				}
				  this.$forceUpdate()
			},
			// 上传文件
			upwj(){
				console.log('上传文件')
			},
			
			// 提交答案 1 正常提交  2到时间自动提交
			async tjda(type){
				console.log(this.list)
				// if(this.istj){
				// 	return
				// }
				let arr=[]
				let isallanswer=true//是否都回答完
				this.list.map(item=>{
					if(!item.isanswer){
						isallanswer=false
					}
					if(item.type==6){
						let arrr=''
						if(item.fileLists.length>0){
							item.fileLists.map(i=>{
								console.log(i.id)
								arrr+=i.id+','
							})
							arrr=arrr.substring(0, arrr.length - 1);
							console.log(arrr)
							item.answer=arrr
						}else{
							item.answer=''
						}
						
					}
					arr.push({id:item.examquestions_id,correct_option:item.answer})
				})
				if(!isallanswer && type==1){
					this.$message.info('请回答完所有问题')
					return
				}
				// return
				console.log(JSON.stringify(arr))
				arr.map(item=>{
					console.log(typeof(item.correct_option))
				})
				// return
				this.istj=true
				let res = await this.$api.post(global.apiUrls.post68d346710a5df, {
					exampaper_id: this.id,
					answer_info: JSON.stringify(arr),
					// dt_time: this.examTime * 60 - this.remainingSeconds
				});
				if (res.data.code != 1) {
					this.$message.info(res.data.msg);
					return
				}
				// this.getred()
				return
				uni.redirectTo({
					url:'/pages/suitc/csjg/csjg?id='+this.id+'&type=1&time='+this.time+'&time1='+this.time1
				})
			},
			// 公告 已读
			async getred(){
				let datalist = await this.$api.get(global.apiUrls.post68413be3159e9, {
					aid: this.messid,
				});
							
				// if (datalist.data.code != 1) {
				// 	this.$message.info(datalist.data.msg);
				// 	return
				// }
			},
		},
		beforeDestroy() {
			console.log('beforeDestroy')
			if (this.timer) clearInterval(this.timer);
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(248, 248, 248, 1);
		background-size: 100% auto;

		.cs_flex_4_ibhf {
			width: 750rpx;
			height: 190rpx;
			overflow: hidden;
			z-index: 10;
			bottom: calc(0rpx + var(--window-bottom));
			background: #FFFFFF;
			background-size: 100% auto;
			box-shadow: 0rpx -1rpx 0rpx 1rpx #EEEEEE;
			.cs_fd4_0_ibhfs{
				width: 264rpx;
				height: 84rpx;
				border-radius: 42rpx;
			}
			.cs_fd4_0_ibhf {
				border: 1px solid #145EFD;
				background: #FFFFFF;
				width: 264rpx;
				height: 84rpx;
				border-radius: 42rpx;

				.cs_fd4_0_c0_ibhf {
					font-size: 32rpx;
					color: rgba(20, 94, 253, 1);
				}
			}

			.cs_fd4_1_ibhf {
				background: linear-gradient(270deg, #145EFD 0%, #6E9CFF 100%);
				width: 264rpx;
				height: 84rpx;
				border-radius: 42rpx;

				.cs_fd4_1_c0_ibhf {
					color: var(--benbenFontColor3);
					font-size: 32rpx;
				}
			}
		}

		.cs_flex_3_ibhf {
			height: 300rpx;
			width: 100%;
		}

		.cs_flex_2_ibhf {
			margin: 24rpx 0rpx 0rpx 0rpx;
			padding: 32rpx 24rpx 32rpx 24rpx;
			background: rgba(255, 255, 255, 1);
			background-size: 100% auto;
		}

		.cs_fd2_0_ibhf {
			margin: 0rpx 0rpx 32rpx 0rpx;

			.cs_fd2_0_c1_ibhf {
				margin: 0rpx 16rpx 0rpx 16rpx;
				font-size: 32rpx;
				font-weight: 500;
			}
		}

		.cs_fd2_0_c0_ibhf {
			width: 32rpx;
			height: 32rpx;
			border-radius: 0rpx;
		}

		.cs_fd2_1_c0_c0_ibhf {
			width: 32rpx;
			height: 32rpx;
			border-radius: 0rpx;
			margin: 0rpx 16rpx 0rpx 0rpx;
		}

		.cs_fd2_1_c0_c1_ibhf {
			font-weight: 500;
			line-height: 32rpx;
		}

		.cs_fd2_1_c2_ibhf {
			background: #F8F8FA;
			width: 702rpx;
			height: 88rpx;
			padding: 24rpx;

			.cs_fd2_1_c2_c2_ibhf {
				margin: 0rpx 0rpx 0rpx 88rpx;
			}
		}

		.cs_fd2_1_c2_c1_ibhf {
			color: rgba(40, 96, 244, 1);
		}

		.cs_fd2_2_c0_ibhf {
			margin: 0rpx 0rpx 24rpx 0rpx;
		}

		.cs_fd2_2_c0_c0_ibhf {
			font-weight: 600;
		}

		.cs_fd2_2_c1_ibhf {
			color: rgba(112, 112, 112, 1);
		}

		.cs_fd1_0_ibhf {
			padding: 32rpx 24rpx 24rpx 24rpx;
			background: rgba(255, 255, 255, 1);
			background-size: 100% auto;

			.cs_fd1_0_c0_ibhf {
				margin: 0rpx 0rpx 44rpx 0rpx;

				.cs_fd1_0_c0_c0_ibhf {
					width: 5rpx;
					height: 30rpx;
					background: rgba(20, 94, 253, 1);
					margin: 0rpx 10rpx 0rpx 10rpx;
					transform: scaleX(0.5);
				}

				.cs_fd1_0_c0_c3_ibhf {
					margin: 0rpx 0rpx 0rpx auto;
					font-size: 32rpx;
				}
			}

			.cs_fd1_0_c1_ibhf {
				margin: 0rpx 0rpx 36rpx 0rpx;
			}
			.cs_fd1_0_c2_c0_c0_ibhf {
				background: #EBEEF2;
				width: 48rpx;
				height: 48rpx;
				border-radius: 24rpx;
				margin: 0rpx 20rpx 0rpx 0rpx;
			
				.cs_fd1_0_c2_c0_c0_c0_ibhf {
					color: #333333;
				}
			}
			.cs_fd1_0_c2_c0_ibhf {
				background: rgba(20, 94, 253, 0.1);
				width: 702rpx;
				height: 88rpx;
				border-radius: 16rpx;
				margin: 0rpx 0rpx 36rpx 0rpx;
				padding: 0rpx 24rpx 0rpx 24rpx;
				border: 1px solid rgba(20, 94, 253, 1);

				.cs_fd1_0_c2_c0_c0_ibhf {
					background: rgba(20, 94, 253, 1);
					width: 48rpx;
					height: 48rpx;
					border-radius: 24rpx;
					margin: 0rpx 20rpx 0rpx 0rpx;

					.cs_fd1_0_c2_c0_c0_c0_ibhf {
						color: var(--benbenFontColor3);
					}
				}
			}

			.cs_fd1_0_c2_c2_ibhf {
				background: rgba(253, 118, 46, 0.1);
				width: 702rpx;
				height: 88rpx;
				border-radius: 16rpx;
				margin: 0rpx 0rpx 36rpx 0rpx;
				padding: 0rpx 24rpx 0rpx 24rpx;
				border: 1px solid rgba(253, 118, 46, 1);

				.cs_fd1_0_c2_c0_c0_ibhf {
					background: rgba(253, 118, 46, 1);
					width: 48rpx;
					height: 48rpx;
					border-radius: 24rpx;
					margin: 0rpx 20rpx 0rpx 0rpx;
					color: #ffffff;
				}
				.cs_fd1_0_c2_c0_c0_c0_ibhf {
					color: #ffffff;
				}
			}

			.cs_fd1_0_c3_c0_ibhf {
				line-height: 33rpx;
				.cs_fd1_0_c3_c0_c0_ibhf {
				    background: url(image-path('stcimg/5.png')) no-repeat;
				    background-size: 100% auto;
				    width: 702rpx;
				    height: 104rpx;
				    margin: 0rpx 0rpx 20rpx 0rpx;
				    color: rgba(27, 37, 64, 1);
				    font-size: 28rpx;
				
				    .cs_fd1_0_c3_c0_c0_c0_ibhf {
				        width: 48rpx;
				        height: 48rpx;
				        border-radius: 0rpx;
				        margin: 0rpx 24rpx 0rpx 52rpx;
				    }
				
				    .cs_fd1_0_c3_c0_c0_c2_ibhf {
				        width: 16rpx;
				        height: 16rpx;
				        border-radius: 0rpx;
				        margin: 0rpx 30rpx 0rpx auto;
				    }
				}
				.cs_fd1_0_c3_c0_c1_ibhf {
					width: 700rpx;
					padding: 24rpx 24rpx 0rpx 24rpx;
					
					.cs_flex_list_fd1_0_c3_c0_c1_ibhf {
						margin: 0rpx 0rpx 20rpx 0rpx;
					}

					.cs_flex_file_fd1_0_c3_c0_c1_ibhf {
						line-height: 60rpx;
					}

					.cs_flex_text_fd1_0_c3_c0_c1_ibhf {
						color: var(--benbenFontColor2);
					}

					.cs_flex_icon_fd1_0_c3_c0_c1_ibhf {
						z-index: 10;
						color: var(--benbenFontColor2);
						padding: 0rpx 0rpx 0rpx 15rpx;
					}

					.cs_fd1_0_c3_c0_c11_ibhf {
						// border-radius: 40rpx 40rpx 40rpx 40rpx;
						font-size: 32rpx;
						background: url(image-path('stcimg/7.png')) no-repeat;
						// background: var(--benbenbgColor2);
						background-size: 100% auto;
						color: rgba(40, 96, 244, 1);
						line-height: 104rpx;
						text-align: center;
					}
				}

				.cs_fd1_0_c3_c0_c2_ibhf {
					background: url(image-path('stcimg/7.png')) no-repeat;
					background-size: 100% auto;
					width: 702rpx;
					height: 104rpx;
					margin: 0rpx 0rpx 20rpx 0rpx;
					color: rgba(20, 94, 253, 1);
					font-size: 28rpx;
				}

				.cs_fd1_0_c3_c0_c1_c0_ibhf {
					color: rgba(211, 42, 41, 1);
					font-size: 28rpx;
				}

				.cs_fd1_0_c3_c0_c1_c1_ibhf {
					font-size: 24rpx;
					color: rgba(153, 153, 153, 1);
				}
			}

			.cs_fd1_0_c4_ibhf {
				width: 100%;
				border-radius: 10rpx 10rpx 10rpx 10rpx;
				background: rgba(248, 248, 250, 1);
				padding: 10rpx 10rpx 0rpx 16rpx;
				margin: 32rpx 32rpx 0rpx 0rpx;

				.cs_input_fd1_0_c4_ibhf {
					width: 100%;
					height: 140rpx;
					font-size: 28rpx;
					font-weight: 400;
					color: #333;
					white-space: pre-wrap;
				}

				.cs_numberfd1_0_c4_c0_ibhf {
					width: 100%;
					font-size: 24rpx;
					color: #FFFFFF;
					line-height: 46rpx;
					font-weight: 400;
				}
			}

			.cs_fd1_0_c5_c0_ibhf {
				border-radius: 42rpx;
				width: 500rpx;
				line-height: 84rpx;
				font-size: 24rpx;
				background: #4781f5;
				color: #fff;
				height: 84rpx;
			}
		}

		.cs_fd1_0_c0_c1_ibhf {
			font-size: 32rpx;
			font-weight: 500;
		}

		.cs_fd1_0_c0_c4_ibhf {
			font-size: 26rpx;
			color: rgba(153, 153, 153, 1);
		}

		.cs_fd1_0_c2_c1_ibhf {
			background: #F8F8FA;
			width: 702rpx;
			height: 88rpx;
			border-radius: 16rpx;
			margin: 0rpx 0rpx 36rpx 0rpx;
			padding: 0rpx 24rpx 0rpx 24rpx;
		}

		.cs_fd1_0_c2_c1_c0_ibhf {
			background: #EBEEF2;
			width: 48rpx;
			height: 48rpx;
			border-radius: 24rpx;
			margin: 0rpx 20rpx 0rpx 0rpx;
		}

		.cs_flex_0_ibhf {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			z-index: 10;
			top: 0rpx;
			background: #fff;
			background-size: 100% auto !important;

			.cs_fd0_0_ibhf {
				padding: 0rpx 32rpx 0rpx 32rpx;

				.cs_fd0_0_c1_c0_ibhf {
					font-size: 36rpx;
					font-weight: 700;
					color: #333333;
					line-height: 50rpx;
				}
			}
		}

		.cs_fd0_0_c0_ibhf {
			width: 120rpx;

			.cs_fd0_0_c0_c0_ibhf {
				font-size: 36rpx;
				color: #333;
			}
		}
	}
	.time {
		width: 100%;
		height: 96rpx;
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		margin: 24rpx;
		font-weight: 500;
		font-size: 36rpx;
		color: #333333;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	
</style>
